<style>
.tablelist{
	overflow:auto;
}
.hDiv{
	overflow: visible;
display: inline-table;
}
.hDivBox{
	float: none;
}
.bDiv{
height: 110px;
display: inline-table;
}
.fixedheader{
	/*position: fixed;*/
}
.fixedheaderNext{
	padding-left:30px;
}
.aclinputdiv{
	cursor:pointer;
}
</style>
<div
	class="flexigrid ui-datepicker ui-widget ui-widget-content  ui-corner-all"
	id="accountsList" style="width: 99%; display: block;">
	<div class="mDiv ui-datepicker-header ui-widget-header  ui-corner-all">
		<div class="ftitle">权限列表</div>
			<div class="ptogtitle" title="Minimize/Maximize Table"><span></span></div>
		</div>
		<div class="tablelist">
			<div class="hDiv" style="">
				<div class="hDivBox">
					<table cellpadding="0" cellspacing="0">
						<thead>
							<tr>
								<th align="center" class="sorted fixedheader" axis="col0" abbr="id">
								<div style="text-align: center;" class="">&nbsp;</div>
								</th>
								<?php foreach ($this->header1 as $header){?>
								<th colspan="<?php echo $header["childrens"]?>" align="center" class="sorted" axis="col0" abbr="id">
								<div style="text-align: center;" class=""><?php echo $header["title"]?></div>
								</th>
								<?php }?>
							</tr>
							<tr>
								<th abbr="id" axis="col0" align="center" class="sorted fixedheader">
								<div  style="text-align: center; width: 60px;">用户名</div>
								</th>
								<?php foreach ($this->header2 as $id => $header){?>
								<th abbr="name_cn" axis="col1" align="left" class="">
								<div style="text-align: center; width: 60px;" class=""><?php echo $header?></div>
								</th>
								<?php }?>
							</tr>
						</thead>
					</table>
				</div>
			</div>
			<div class="bDiv" style="height: 500px;">
			<form name="aclform" id="aclform" method="post" action="">
				<table id="port_lst" style="" cellpadding="0" cellspacing="0" border="0">
					<tbody>
					
						<?php $i=0; foreach ($this->users as $user){?>
						<tr id="row<?php echo $user->id?>" <?php if($i++%2){ echo "class='erow'";}?>>
							<td align="center" abbr="id" class="sorted fixedheader">
							<div style="text-align: center; width: 60px;"><?php echo $user->showname?></div>
							</td>
							<?php foreach ($this->header2 as $id => $header){
								$isChecked = key_exists("{$user->id}_{$id}", $this->privilege)?"checked='checked'":"";
							?>
							<td align="left" abbr="name_cn">
							<div style="text-align: center; width: 60px;" class="aclinputdiv"><input name="acl[]" value="<?php echo $user->id;?>,<?php echo $id;?>" <?php echo $isChecked;?> type="checkbox" /></div>
							</td>
							<?php }?>			
						</tr>
						<?php }?>
					</tbody>
				</table>
			</form>
			<div class="iDiv" style="display: none;"></div>
		</div>
	</div>
	<div style=" text-align: right; padding: 10px; ">
		<button id="save_button">保存修改</button>
	</div>
</div>
<script>
$(function(){
	$("#save_button").button().click(function(){
		aclform.submit();
	});
	
	$(".aclinputdiv").click(function(){
		$(this).find("input").click();
	});
	$(".aclinputdiv input").click(function(event){
		event.stopPropagation();
	});

	$(".tablelist").bind("scroll",function(){
		if($(".tablelist")[0].scrollLeft>70){
			$(".fixedheader").css("position","fixed");
		}else{
			$(".fixedheader").css("position","static");
		}
	});
});
</script>